package com.egao.common.module.counsel.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.egao.common.core.web.PageParam;
import com.egao.common.module.counsel.entity.CounselTeacher;
import com.egao.common.module.counsel.mapper.CounselTeacherMapper;
import com.egao.common.module.counsel.service.CounselTeacherService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lym
 * @date 2022/1/24 17:14
 */
@Service
public class CounselTeacherServiceImpl extends ServiceImpl<CounselTeacherMapper, CounselTeacher> implements CounselTeacherService {

    @Override
    public List<CounselTeacher> listPage(PageParam<CounselTeacher> pageParam) {
        pageParam.setDefaultOrder(null, new String[]{"create_time"});
        return baseMapper.listPage(pageParam);
    }

    @Override
    public CounselTeacher getByUserId(Integer userId) {
        return baseMapper.selectOne(new LambdaQueryWrapper<CounselTeacher>().eq(CounselTeacher::getUserId, userId));
    }
}
